

package com.tool.tcpimg;

import org.come.bean.ImgZoom;
import org.come.test.Main;
import org.come.until.CutButtonImage;
import org.come.until.Util;

import java.awt.*;


public class LoginTipBox
{

    private RichLabel label;
    private int time;
    private ImgZoom imgZoom;
    private int px;
    private int width;
    private int height;
    private int type = 0;

    public LoginTipBox(String text)
    {
        label = new RichLabel(text, UIUtils.TEXT_NAME_FONT, 12);
        label.setLocation(6, 6);
        Dimension d = label.computeSize(300);
        d.setSize(300, d.getHeight() );
        label.setSize(d);
        width = d.width + 12;
        height = d.height + 12;
        imgZoom = CutButtonImage.cuts("inkImg/hongmu/2/88_png.xy2uiimg.png", 6, 6, true);
        imgZoom.setMiddlew(d.width);
        imgZoom.setMiddleh(d.height);
        time = Util.TIME_CHAT2;
        px = Main.frame.getLoginJpanel().getWidth() / 2 - d.width / 2;
    }

    public void paint(Graphics g)
    {
        g.translate(px, 0);
        imgZoom.draw(g);
        g.translate(label.getX(), label.getY());
        label.paint(g);
        g.translate(-px - label.getX(), -label.getY());
    }

    public RichLabel getLabel()
    {
        return label;
    }

    public void setLabel(RichLabel label)
    {
        this.label = label;
    }

    public boolean IsTime()
    {
        if(type == 1) {
            return true;
        }
        return time-- > 0;
    }

    public ImgZoom getImgZoom()
    {
        return imgZoom;
    }

    public void setImgZoom(ImgZoom imgZoom)
    {
        this.imgZoom = imgZoom;
    }

    public int getPx()
    {
        return px;
    }

    public void setPx(int px)
    {
        this.px = px;
    }

    public int getWidth()
    {
        return width;
    }

    public void setWidth(int width)
    {
        this.width = width;
    }

    public int getHeight()
    {
        return height;
    }

    public void setHeight(int height)
    {
        this.height = height;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public int getTime() {
        return time;
    }

    public void setTime(int time) {
        this.time = time;
    }
}
